<template>
  <div class="printForm">
    <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div>
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('申请标题') }}</td>
        <td colspan="3">{{ form.actTitle }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('事项名称') }}</td>
        <td>{{ form.itemName }}</td>

        <td class="tit">{{ $t('发生时间') }}</td>
        <td>{{ parseTime(form.happenTime) }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('事项类别') }}</td>
        <td>
          {{ typeFormat(form.itemType) }}
        </td>

        <td class="tit">{{ $t('是否提交基金业协会备案') }}</td>
        <td>
          {{ recordFormat(form.fundSocietyRecord) }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('是否处理') }}</td>
        <td colspan="3">
          {{ handleFormat(form.handle) }}
        </td>
      </tr>
      <tr v-if="form.handle === 'Y'">
        <td class="tit">{{ $t('处理日期') }}</td>
        <td>
          {{ parseTime(form.handleTime) }}
        </td>
        <td class="tit">{{ $t('处理方式') }}</td>
        <td>
          {{ form.handleMode }}
        </td>
      </tr>
      <tr v-if="form.handle === 'Y'">
        <td class="tit">{{ $t('处理描述') }}</td>
        <td colspan="3">
          {{ form.handleDesc }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('事项描述') }}</td>
        <td colspan="3">
          {{ form.itemDesc }}
        </td>
      </tr>
    </table>
    <FileView :list.sync="form.fileList" data-type="fund_matters" :business-id="autoBusinessId($route.query.id, form)" />

  </div>
</template>

<script>
import { getFundMatters } from '@/api/fund/matters/fundMatters'

export default {
  data() {
    return {
      // 事项类别 字典deal_matters_category字典
      itemTypeOptions: [], // 是否提交基金业协会备案字典
      fundSocietyRecordOptions: [], // 是否处理 字典sys_yes_no字典
      handleOptions: [], // 表单参数
      form: {
        fileList: []
      },
      // 遮罩层
      loading: false,
      // 是否隐藏保存等按钮
      btnHide: false
    }
  },
  created() {
    this.getDicts('deal_matters_category').then((response) => {
      this.itemTypeOptions = response.data
    })
    this.getDicts('yes_no_record').then((response) => {
      this.fundSocietyRecordOptions = response.data
    })
    this.getDicts('sys_yes_no').then((response) => {
      this.handleOptions = response.data
    })
    this.$bus.$emit('async_done')
  },
  methods: {
    // 初始化数据
    init(data) {
      if (data != null && data.id !== undefined) {
        getFundMatters(data.id).then((response) => {
          this.form = response.data
        })
      }
    },
    typeFormat(row) {
      return this.selectDictLabel(this.itemTypeOptions, row)
    },
    recordFormat(row) {
      return this.selectDictLabel(this.fundSocietyRecordOptions, row)
    },
    handleFormat(row) {
      return this.selectDictLabel(this.handleOptions, row)
    }
  }
}
</script>
